package com.the_ring.structural.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author: t22306139
 * @date: 2023/12/1  8:55
 */
public class BuyHouseJdkProxy implements InvocationHandler {

    private final Object target;

    public BuyHouseJdkProxy(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("买房前中介处理");
        Object result = method.invoke(target, args);
        System.out.println("买房后中介处理");
        return result;
    }
}
